package com.fr.lintcode;

public class Q532 {

    /**
     * @param A:
     *            an array
     * @return: total of reverse pairs
     */
    public long reversePairs(int[] A) {
        // write your code here
        int length = A.length;
        int count = 0;
        for (int i = 0; i < length; i++) {
            for (int j = i + 1; j < length; j++) {
                if (A[i] > A[j]) {
                    count++;
                }
            }
        }
        return count;
    }
}
